import React from 'react';
import {WeaFormItem, WeaSelect} from 'ecCom';
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;

// 滚动方向
class EScrollDirection extends React.Component {
    state = {
        value: this.props.value
    };

    render() {
        const { onChange } = this.props;
        return (
            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@xieawo`} label={getLabel(20281, '滚动方向')} labelCol={{span: 6}} wrapperCol={{span: 16}}>
                <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@vkpghk`}
                    options={
                        this.props.options.map((item) => {
                            return {key: item.key, selected: false, showname: item.value};
                        })
                    }
                    value={this.state.value}
                    style={{width: '100px'}}
                    onChange={value => {
                        this.setState({value: value});
                        if(onChange && typeof onChange == 'function'){
                            onChange(value)
                        }
                    }}
                />
            </WeaFormItem>
        );
    }

    getSaveValues() {
        return this.state.value;
    }
}

export default EScrollDirection;
